# Mozilla Public License Terms #
# ...                          #

DEPTH=..

# Note that such a parsing method works only when everyting is within one line.
EXTENSION_VERSION= $(shell\
	grep	'em:version' install.rdf |\
	sed	-e 's/em:version//g'\
		-e 's|[ 	<>/]||g'\
		-e 's/\./_/g')

EXTENSION_NAME= $(shell\
	grep	'em:name' install.rdf |\
	sed	-e 's/em:name//g'\
		-e 's|[<>/]||g'\
		-e 's/^[ 	]*//g'\
		-e 's/ /_/g')

XPI_PATH=$(DEPTH)/$(EXTENSION_NAME)_$(EXTENSION_VERSION).xpi

archive:
	zip -r0 $(XPI_PATH) ./* -x .svn* *.svn* Makefile

clean:
	rm -f $(DEPTH)/*.xpi

install: archive
	$(shell firefox $(XPI_PATH))
